package com.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydd.entity.SysConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysConfigMapper extends BaseMapper<SysConfig> {

    /**
     * 增加配置
     * @param sysConfig
     */
    void add(SysConfig sysConfig);

    /**
     * 获取所有配置数据
     * @return
     */
    List<SysConfig> all();

    /**
     * black_ip 查找黑名单
     * @return
     */
    @Select("select attr_value from sys_config where attr_key=#{attrKey}")
    String selectByattrKey(String attrKey);

    /**
     * black_ip找key和name
     * @return
     */
    @Select("select * from sys_config where attr_key=#{attrKey}")
    SysConfig selectByattrKey2();
}
